﻿/**
 * 地域添加界面
 * @author lw
 */
Ext.define('system.abasis.area.biz.AreaEdit', {
	extend : 'Ext.window.Window',
	grid : null,
	treepanel : null,
	oper : Ext.create('system.abasis.area.biz.AreaOper'),
	initComponent:function(){
	    var me = this;

	    var gjid = Ext.create('Ext.form.field.Hidden',{
	    	fieldLabel: '根级ID',
	    	name: 'baseid',
	    	value: 'FSDAREA'
	    });
	    
	    var lbbm = Ext.create('system.widget.FsdTextField',{
	    	fieldLabel: '地域编码',
	    	labelAlign:'right',
	    	labelWidth:70,
	        width : 340,
	    	name: 'code',
	    	maxLength: 20,
	    	allowBlank: false,
	    	blankText: '请输入地域编码',
	    	maxLengthText: '地域编码不能超过20个字符'
	    });

	    var ssfjname = Ext.create('Ext.form.field.Hidden',{
	    	fieldLabel: '所属地域名称',
	    	name: 'parentname'
	    });
	    var ssfj = Ext.create('system.widget.FsdTreeComboBox',{
	    	fieldLabel : '所属地域',
	    	labelAlign:'right',
	    	labelWidth:70,
	    	rootText : '地域类别',
	    	rootId : 'FSDAREA',
	        width : 340,
	        name : 'parentid',
	        baseUrl:'a_area/load_AsyncAreaTree.do',//访问路劲	        
	        allowBlank: false,
	        blankText: '请选择所属地域',
	        hiddenName : 'parentname'//隐藏域Name
	    });
	    
	    var lbmc = Ext.create('system.widget.FsdTextFieldZJF',{
	    	fieldLabel: '地域名称',
	    	labelAlign:'right',
	    	labelWidth:70,
	        width : 340,
	    	name: 'name',
	    	fname : 'symbol',
	    	maxLength: 20,
	    	allowBlank: false,
	    	blankText: '请输入地域名称',
	    	maxLengthText: '地域名称不能超过20个字符'
	    });
	    
	    var zjf = Ext.create('system.widget.FsdTextField',{
	    	fieldLabel: '助记符',
	    	labelAlign:'right',
	    	labelWidth:70,
	        width : 340,
	    	name: 'symbol',
	    	maxLength: 20,
	    	allowBlank: false,
	    	blankText: '请输入助记符',
	    	maxLengthText: '助记符不能超过20个字符'
	    });
	    
	    var dyqc = Ext.create('system.widget.FsdTextField',{
	    	fieldLabel: '地域全称',
	    	labelAlign:'right',
	    	labelWidth:70,
	        width : 340,
	    	name: 'fullname',
	    	maxLength: 100,
	    	allowBlank: true,
	    	blankText: '请输入信息',
	    	maxLengthText: '不能超过100个字符'
	    });
	    
	    var xzqdm = Ext.create('system.widget.FsdTextField',{
	    	fieldLabel: '行政区代码',
	    	labelAlign:'right',
	    	labelWidth:70,
	        width : 340,
	    	name: 'admincode',
	    	maxLength: 10,
	    	allowBlank: true,
	    	blankText: '请输入信息',
	    	maxLengthText: '不能超过10个字符'
	    });
	    
	    var qhdm = Ext.create('system.widget.FsdTextField',{
	    	fieldLabel: '区号代码',
	    	labelAlign:'right',
	    	labelWidth:70,
	        width : 340,
	    	name: 'areacode',
	    	maxLength: 10,
	    	allowBlank: true,
	    	blankText: '请输入信息',
	    	maxLengthText: '不能超过10个字符'
	    });
	    
	    var yzbm = Ext.create('system.widget.FsdTextField',{
	    	fieldLabel: '邮政编码',
	    	labelAlign:'right',
	    	labelWidth:70,
	        width : 340,
	    	name: 'postcode',
	    	maxLength: 10,
	    	allowBlank: true,
	    	blankText: '请输入信息',
	    	maxLengthText: '不能超过10个字符'
	    });
	    
	    var pxbh = Ext.create('system.widget.FsdNumber',{
	    	fieldLabel: '排序编号',
	    	labelAlign:'right',
	    	labelWidth:70,
	        width : 340,
	    	name: 'sort',
	    	maxLength: 3,
	    	minValue: 0,
	    	allowDecimals : false,//是否允许输入小数
	    	allowBlank: false,
	    	blankText: '请输入排序编号',
	    	maxLengthText: '排序编号不能超过3个字符'
	    });
	    
	    var beizhu = Ext.create('system.widget.FsdTextField',{
	    	fieldLabel: '备注',
	    	labelAlign:'right',
	    	labelWidth:70,
	        width : 340,
	    	name: 'remark',
	    	maxLength: 50,
	    	maxLengthText: '备注不能超过50个字符'
	    });
	    
	    me.on('show' , function(){
	    	ssfj.setText(ssfjname.getValue());
	    });
	    
	    var form = Ext.create('Ext.form.Panel',{
			xtype : 'form',
			defaultType : 'textfield',
			header : false,// 是否显示标题栏
			border : 0,
			padding : '20 0 0 20',
			items : [{
                name: "id",
                xtype: "hidden"
            }, gjid, ssfjname, ssfj, lbmc, zjf, xzqdm, qhdm, yzbm, pxbh, beizhu]
        });
	        
	    Ext.apply(this,{
	        width:400,
	        height:310,
	        collapsible : true,
	        bodyStyle : "background-color:#ffffff;",// 设置背景颜色 白色
	        resizable:false,// 改变大小
	        items : [ form ],
	        buttons : [{
				xtype : "fsdbutton",
				popedomCode : 'dylbbj',
	        	name : 'btnsave',
			    text : '保存',
			    iconCls : 'acceptIcon',
			    handler : function() {
    				me.oper.formSubmit(form, me.grid, me.treepanel);
			    }
		    }, {
			    text : '关闭',
			    iconCls : 'deleteIcon',
			    handler : function() {
			       me.close();
                }
		    }]
	    });
	    this.callParent(arguments);
	}
});